home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / GMS / Source / Asm / Fading / GreenFade.s next >
Encoding:
Text File  |  1997-05-01  |  2.9 KB  |  116 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;AGA Fade
  3. ;--------
  4. ;Fades in a 32 colour AGA picture (24 bit colour).  Then up to a specified
  5. ;colour (greenish yellow), and then out to black.
  6. ;
  7. ;Press left mouse button to exit.
  8.  
  9.     INCDIR    "INCLUDES:"
  10.     INCLUDE    "games/games_lib.i"
  11.     INCLUDE    "games/games.i"
  12.  
  13. CALL    MACRO
  14.     jsr    _LVO\1(a6)
  15.     ENDM
  16.  
  17.     SECTION    "AGAFade",CODE
  18.  
  19. ;===========================================================================;
  20. ;                             INITIALISE DEMO
  21. ;===========================================================================;
  22.  
  23.     STARTGMS
  24.  
  25. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  26.     move.l    GMSBase(pc),a6
  27.     lea    PictureTags(pc),a1
  28.     CALL    LoadPic
  29.     tst.l    d0
  30.     beq.s    .Error_Picture
  31.  
  32.     move.l    Picture(pc),a1
  33.     lea    ScreenTags(pc),a0
  34.     move.l    PIC_Data(a1),GMem
  35.     CALL    ShowScreen
  36.     tst.l    d0
  37.     beq.s    .Error_Screen
  38.  
  39.     bsr.s    Main
  40.  
  41. .ReturnToDOS
  42.     move.l    GMSBase(pc),a6
  43.     move.l    Picture(pc),a1
  44.     CALL    FreePic
  45. .Error_Picture
  46.     move.l    Screen(pc),a0
  47.     CALL    DeleteScreen
  48. .Error_Screen
  49.     MOVEM.L    (SP)+,A0-A6/D1-D7
  50.     moveq    #ERR_OK,d0
  51.     rts
  52.  
  53. ;===========================================================================;
  54. ;                                MAIN CODE
  55. ;===========================================================================;
  56.  
  57. Main:    move.l    Screen(pc),a0    ;a0 = GameScreen
  58.     moveq    #$00,d0    ;d0 = FadeState
  59.     moveq    #5,d1    ;d1 = Speed of fade.
  60.     move.l    Picture(pc),a1    ;a1 = Picture structure.
  61.     move.l    PIC_Palette(a1),a1    ;a1 = Palette to fade to.
  62.     moveq    #$000000,d2    ;d2 = Fading from black.
  63.     moveq    #00,d3    ;d3 = Start colour.
  64.     move.l    GS_AmtColours(a0),d4    ;d4 = Amount of colours.
  65. .f_in    CALL    WaitVBL
  66.     CALL    ColourToPalette    ;Do the fade routine.
  67.     tst.w    d0    ;Has the fade finished yet?
  68.     bne.s    .f_in    ;If not, keep doing it.
  69.  
  70.     moveq    #2,d1    ;d1 = Speed of fade.
  71.     move.l    Picture(pc),a1    ;a1 = Picture structure.
  72.     move.l    PIC_Palette(a1),a1    ;a1 = Palette we are fading from.
  73.     move.l    #$75F343,d2    ;d2 = Colour we are fading to.
  74. .f_mid    CALL    WaitVBL
  75.     CALL    PaletteToColour    ;Do the fade routine.
  76.     tst.w    d0    ;Has the fade finished yet?
  77.     bne.s    .f_mid    ;If not, keep doing it.
  78.  
  79.     moveq    #2,d1    ;d1 = Speed of fade.
  80.     move.l    #$a5F343,d2    ;d2 = Colour.
  81.     moveq    #$000000,d5    ;d5 = Colour.
  82. .f_out    CALL    WaitVBL
  83.     CALL    ColourMorph    ;Do the fade routine.
  84.     tst.w    d0    ;Has the fade finished yet?
  85.     bne.s    .f_out    ;If not, keep doing it.
  86.     rts
  87.  
  88. ;===========================================================================;
  89. ;                                  DATA
  90. ;===========================================================================;
  91.  
  92. ScreenTags:
  93.     dc.l    TAGS_GAMESCREEN
  94. Screen:    dc.l    0
  95.     dc.l    GSA_MemPtr1
  96. GMem:    dc.l    0
  97.     dc.l    GSA_AmtColours,32
  98.     dc.l    GSA_ScrWidth,320
  99.     dc.l    GSA_ScrHeight,256
  100.     dc.l    TAGEND
  101.  
  102. PictureTags:
  103.     dc.l    TAGS_PICTURE
  104. Picture    dc.l    0
  105.     dc.l    PCA_Width,320
  106.     dc.l    PCA_Height,256
  107.     dc.l    PCA_AmtColours,32
  108.     dc.l    PCA_Options,GETPALETTE|VIDEOMEM
  109.     dc.l    PCA_File,.file
  110.     dc.l    TAGEND
  111.  
  112. .file    dc.b    "GMS:demos/data/PIC.Loading",0
  113.     even
  114.  
  115.  
  116.